﻿using ReflectionStudio.Components.UserControls;
using ReflectionStudio.Core.Events;
using System;
using System.ComponentModel;
using System.Data;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
namespace WPFExcelReport
{ 
    public partial class YGRAV95 : DocumentBase
    {
        #region ==IsAB===========
        public static readonly DependencyProperty IsABProperty = DependencyProperty.Register("IsAB",
            typeof(bool), typeof(YGRAV95),
            new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnIsABChanged));
        public bool IsAB
        {
            get
            {
                return (bool)GetValue(IsABProperty);
            }
            set
            {
                SetValue(IsABProperty, value);
            }
        }
        private static void OnIsABChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as YGRAV95;
            if (src != null)
            {
                src.IsAB = (bool)e.NewValue;
            }
        }
        #endregion 
        #region ==IsAV===========
        public static readonly DependencyProperty IsAVProperty = DependencyProperty.Register("IsAV",
            typeof(bool), typeof(YGRAV95),
            new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnIsAVChanged));
        public bool IsAV
        {
            get
            {
                return (bool)GetValue(IsAVProperty);
            }
            set
            {
                SetValue(IsAVProperty, value);
            }
        }
        private static void OnIsAVChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as YGRAV95;
            if (src != null)
            {
                src.IsAV = (bool)e.NewValue;
            }
        }
        #endregion 
        #region ==IsWH===========
        public static readonly DependencyProperty IsWHProperty = DependencyProperty.Register("IsWH",
            typeof(bool), typeof(YGRAV95),
            new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnIsWHChanged));
        public bool IsWH
        {
            get
            {
                return (bool)GetValue(IsWHProperty);
            }
            set
            {
                SetValue(IsWHProperty, value);
            }
        }
        private static void OnIsWHChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as YGRAV95;
            if (src != null)
            {
                src.IsWH = (bool)e.NewValue;
            }
        }
        #endregion 
        #region ==IsVR===========
        public static readonly DependencyProperty IsVRProperty = DependencyProperty.Register("IsVR",
            typeof(bool), typeof(YGRAV95),
            new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnIsVRChanged));
        public bool IsVR
        {
            get
            {
                return (bool)GetValue(IsVRProperty);
            }
            set
            {
                SetValue(IsVRProperty, value);
            }
        }
        private static void OnIsVRChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as YGRAV95;
            if (src != null)
            {
                src.IsVR = (bool)e.NewValue;
            }
        }
        #endregion 
        #region ==IsART===========
        public static readonly DependencyProperty IsARTProperty = DependencyProperty.Register("IsART",
            typeof(bool), typeof(YGRAV95),
            new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnIsARTChanged));
        public bool IsART
        {
            get
            {
                return (bool)GetValue(IsARTProperty);
            }
            set
            {
                SetValue(IsARTProperty, value);
            }
        }
        private static void OnIsARTChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as YGRAV95;
            if (src != null)
            {
                src.IsART = (bool)e.NewValue;
            }
        }
        #endregion 
        #region ==IsCO===========
        public static readonly DependencyProperty IsCOProperty = DependencyProperty.Register("IsCO",
            typeof(bool), typeof(YGRAV95),
            new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnIsCOChanged));
        public bool IsCO
        {
            get
            {
                return (bool)GetValue(IsCOProperty);
            }
            set
            {
                SetValue(IsCOProperty, value);
            }
        }
        private static void OnIsCOChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as YGRAV95;
            if (src != null)
            {
                src.IsCO = (bool)e.NewValue;
            }
        }
        #endregion 
   
        
        VYGRAV95 vm;  
        public YGRAV95()
        {
            vm = new VYGRAV95();
            DataContext = vm;
            InitializeComponent();
            this.Name = "状态查询";  
            ResetTab();
            IsAB = true;
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        { 
            try
            {
                if (DesignerProperties.GetIsInDesignMode(this))
                    return;
                if (IsLoaded)
                    return;
                IsLoaded = true;  
              }
            catch (Exception ex)
            {
                Tracer.Error(ex.StackTrace, ex);
            }
            return;

        } 
        private void btnDZoomIn_Click(object sender, RoutedEventArgs e)
        {
            cVK03.Visibility = Visibility.Hidden;
            vwVKP.SetValue(Grid.RowProperty, 1);
            vwVKP.SetValue(Grid.RowSpanProperty, 2);
        }
        public void ResetTab()
        {
            IsAB = false;
            IsCO = false;
            IsAV = false;
            IsVR = false;
            IsWH = false;
            IsART = false;
        }
        private void btnDZoomOut_Click(object sender, RoutedEventArgs e)
        {
            cVK03.Visibility = Visibility.Visible;
            vwVKP.SetValue(Grid.RowProperty, 2);
            vwVKP.SetValue(Grid.RowSpanProperty, 1);
        }

        private void btnAB_Click(object sender, RoutedEventArgs e)
        {
            ResetTab();
            IsAB = true; 
        }

        private void btnAV_Click(object sender, RoutedEventArgs e)
        {
            ResetTab();
            IsAV = true; 
        }

        private void btnVR_Click(object sender, RoutedEventArgs e)
        {
            ResetTab();
            IsVR = true; 
        }

        private void btnWH_Click(object sender, RoutedEventArgs e)
        {
            ResetTab();
            IsWH = true; 
        }

        private void btnART_Click(object sender, RoutedEventArgs e)
        {
            ResetTab();
            IsART = true;
        }

        private void btnCO_Click(object sender, RoutedEventArgs e)
        {
            ResetTab();
            IsCO = true; 
        }     
    }
}
